﻿#pragma once
#include <map>
#include <array>
#include <vector>
#include <cstdint>
#include <boost/asio.hpp>

enum class TransportType { TCP, UDP };
enum class ProtocolType { MODBUS, MODBUS_RTU, MODBUS_TCP };

struct ModbusData {
    std::vector<bool> coils;
    std::vector<bool> discrete_inputs;
    std::vector<uint16_t> holding_registers;
    std::vector<uint16_t> input_registers;
    
    // 默认大小
    static const size_t DEFAULT_COILS = 1000;
    static const size_t DEFAULT_DISCRETE_INPUTS = 1000;
    static const size_t DEFAULT_HOLDING_REGISTERS = 1000;
    static const size_t DEFAULT_INPUT_REGISTERS = 1000;
};

struct SlaveConfig {
    uint8_t slave_id;
    ModbusData data;
};

// 持久化数据结构
struct PersistenceData {
    std::map<uint8_t, SlaveConfig> slaves;
    uint32_t timestamp;
};
